package lxx.springbootdemo.aspect;

import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Slf4j
@Component
public class apiAspect {

    @Pointcut("execution(* lxx.springbootdemo.swaggerdemo.swaggerdemo.*(..))")
    public void aspect(){

    }

    @Before("aspect()")
    public void before(JoinPoint joinPoint){
        String method = joinPoint.getSignature().getName();
        log.info("前置通知 the Method="+method+"  传入参数为 "+ JSON.toJSONString(joinPoint.getArgs()));
    }
}
